#include <stdio.h>
#include <tchar.h>
#include <iostream>

#include "note.h"


note::note(void)
{
	pos_x = -1;
	pos_y = -1;
	notetype = blank;
	cs = CCSprite::create("grass.png");
}

CCSprite* note::getSprite()
{
	return cs;
}

void note::setnote(int posx,int posy,NOTE_TYPE ty)
{
	pos_x = posx;
	pos_y = posy;
	notetype = ty;
	if(ty == wall)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("wall.jpg"));
	}
	else if(ty == blank)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("grass.png"));
	}
	else if(ty == head)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("head.png"));
	}
	else if(ty == body)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("body.png"));
	}
	else if(ty == foods)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("food.png"));
	}
	else if(ty == badhead)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("badhead.png"));
	}
	else if(ty == badbody)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("badbody.png"));
	}
	else if(ty == stones)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("stones.png"));
	}
	else if(ty == traps)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("traps.png"));
	}
	else if(ty == stick)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("stick.png"));
	}
}

void note::settype(NOTE_TYPE ty)
{
	notetype = ty;
	if(ty == wall)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("wall.jpg"));
	}
	else if(ty == blank)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("grass.png"));
	}
	else if(ty == head)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("head.png"));
	}
	else if(ty == body)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("body.png"));
	}
	else if(ty == foods)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("food.png"));
	}
	else if(ty == badhead)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("badhead.png"));
	}
	else if(ty == badbody)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("badbody.png"));
	}
	else if(ty == stones)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("stones.png"));
	}
	else if(ty == traps)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("traps.png"));
	}
	else if(ty == stick)
	{
		cs->setTexture(CCTextureCache::sharedTextureCache()->addImage("stick.png"));
	}
}

NOTE_TYPE note::gettype()
{
	return notetype;
}

int note::getx()
{
	return pos_x;
}

int note::gety()
{
	return pos_y;
}

note::~note(void)
{
}
